import pymysql

class Db():
    def __init__(self):
        self.con = pymysql.connect(host="localhost", port=3306, user="root",
                                   password="root", database="workflow", charset="utf8",
                                   cursorclass=pymysql.cursors.DictCursor)
        self.course=self.con.cursor()
    def update(self,sql):
        self.course.execute(sql)
        self.con.commit()
    def find_one(self,sql):
        self.course.execute(sql)
        res=self.course.fetchone()
        return res
    def find_all(self,sql):
        self.course.execute(sql)
        res=self.course.fetchall()
        return  res
    def close(self):
        self.course.close()
        self.con.close()
db1=Db()